package com.turing.usdtpay.mvp.dialog;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.turing.usdtpay.R;
import com.turing.usdtpay.base.BaseDialog;

/**
 * @作者：JAY
 * @创建时间：2019/10/20 21:46
 * @描述：
 **/
public class CancelOrderDialog extends BaseDialog<CancelOrderDialog> {

    private TextView mConfirm,mCancel;
    private OnClickListener onClickListener;
    public CancelOrderDialog(Context context) {
        super(context);
    }

    public CancelOrderDialog(Context context, boolean isPopupStyle) {
        super(context, isPopupStyle);
    }

    public CancelOrderDialog(Context context, int theme) {
        super(context, theme);
    }

    @Override
    public View onCreateView() {
        View view = LayoutInflater.from(mContext).inflate(R.layout.dialog_cancel, null);
        mConfirm = (TextView) view.findViewById(R.id.tv_confirm);
        mCancel = (TextView) view.findViewById(R.id.tv_cancel);
        mCancel.setOnClickListener(this);
        mConfirm.setOnClickListener(this);
        return view;
    }

    @Override
    public void setUiBeforeShow() {

    }

    @Override
    public void onClick(View v) {
        if (v.getId() == mConfirm.getId()){
            if (onClickListener != null){
                onClickListener.onCancel();
            }
            dismiss();
        }else if (v.getId() == mCancel.getId()){
            dismiss();
        }
    }

    public void setOnClickListener(OnClickListener onClickListener) {
        this.onClickListener = onClickListener;
    }

    public interface OnClickListener{
        void onCancel();
    }
}
